package com.cskaoyan.day1.datastructure;

/**
 * @author Common-zhou
 * @since 2023-02-27 16:15
 */
public class NodeDemo2 {
    public static void main(String[] args) {
        Node<Integer> node7 = new Node<>();
        node7.data = 7;

        Node<Integer> node8 = new Node<>();
        node8.data = 8;
        node8.next = node7;

        Node<Integer> node5 = new Node<>();
        node5.data = 5;
        node5.next = node8;

        Node<Integer> node10 = new Node<>();
        node10.data = 10;
        node10.next = node5;


        //1.找到5   --》 

        //node5

        // 2.创建一个节点；节点的值设置为22
        Node<Integer> newNode = new Node<>();
        newNode.data = 22;

        // 3.把新创建的节点的next 指向 5.next
        newNode.next = node5.next;

        // 4.5.next 指向 22
        node5.next = newNode;

        Node<Integer> head = node10;
        //
        //while (head != null) {
        //    System.out.printf(head.data + "-->");
        //    head = head.next;
        //}

        NodeUtil.printNode(head);


    }
}
